import os

prefix = '/data/liuhongfei/cnndm/stories/'

with open('all.lst', 'r') as f:
    ids = set()
    for line in f.readlines():
        _id = line.strip().split('/')[-1]
        ids.add(_id)

processed = os.listdir('all')

for filename in processed:
    ids.discard(filename.replace('.json', ''))

with open('new.lst', 'w') as f:
    for _id in ids:
        f.write(prefix + _id + '\n')